WriteF('\n Td - a minimal tools-demon for WB 2/3.x Tools-Menu\n\nCONFIGFILE may contain upto 5 command-lines of the form:\ntitle!command (as you would type it at the shell-prompt).\nSpecial feature: Td recognizes changes in CONFIGFILE while running and\nchanges menu.\n\nDefault CONFIGFILE is s:Td.config\n')
CleanUp(5)
ENDIF
IF nreq:=New(SIZEOF notifyrequest) /* memory is cleared */
sig:=AllocSignal(-1) /* we want to be signalled */
IF sig=-1
WriteF('No signal!\n')
CleanUp(15)
ENDIF
IF myapp_port:=CreateMsgPort() /*setup Port*/
task:=FindTask(0)
nreq.name:=filename
nreq.flags:=NRF_SEND_SIGNAL
nreq.port:=task /* union port/task */
nreq.signalnum:=sig /*prepare struc for notify */
portsig:=Or(Shl(1,myapp_port.sigbit),Shl(1,sig)) /*wait for two signals*/
IF workbenchbase:=OpenLibrary('workbench.library',37)
menuadd()
StartNotify(nreq)
REPEAT
signal:=Wait(portsig)
/*WriteF('\d\n',signal)*/
IF signal = Shl(1,myapp_port.sigbit) /*app-menu-message*/
appmsg:=GetMsg(myapp_port)
IF appmsg <> 0
IF appmsg.id = 6
raus:=1
ELSE
SystemTagList(commstrarr[appmsg.id],0)
ENDIF
ReplyMsg(appmsg)
ENDIF
ELSE /*notify-message*/
menusub() /*remove old menu*/
menuadd() /*setup new menu*/
ENDIF
UNTIL raus <> NIL
EndNotify(nreq)
menusub()
WHILE appmsg:=GetMsg(myapp_port) DO ReplyMsg(appmsg) /*clear Port*/